package de.szut.ita13.sommerfeld.loganalyser;


public class Log {

	public static String[] logColumnNames = {"IP","Hyphen","UserID","Date","Request","Resource","Protocol","Status","Size"};
	public static int[] logColumnsPrefferedWidth = {75,30,70,140,40,400,50,20,50};
	
	private String ipadress;
	private String hyphen;
	private String userid;
	private Date date;
	private String requestcmd;
	private String resource;
	private String protocol;
	private int status;
	private int size;
	
	public Log(String ipadress, String hyphen, String userid, Date date, String requestcmd, String resource, String protocol, int status, int size) {
		this.ipadress = ipadress;
		this.hyphen = hyphen;
		this.userid = userid;
		this.date = date;
		this.requestcmd = requestcmd;
		this.resource = resource;
		this.protocol = protocol;
		this.status = status;
		this.size = size;
	}
	
	public Log(String ipadress) {
		this.ipadress = ipadress;
	}

	public String getIpadress() {
		return ipadress;
	}

	public void setIpadress(String ipadress) {
		this.ipadress = ipadress;
	}

	public String getHyphen() {
		return hyphen;
	}

	public void setHyphen(String hyphen) {
		this.hyphen = hyphen;
	}

	public String getUserid() {
		return userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}
	
	public void setRequestCmd(String requestcmd) {
		this.requestcmd = requestcmd;
	}
	
	public String getRequestCmd() {
		return requestcmd;
	}

	public String getResource() {
		return resource;
	}

	public void setResource(String resource) {
		this.resource = resource;
	}

	public String getProtocol() {
		return protocol;
	}

	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public String getDateString() {
		String hour = (date.getHour() < 10) ? "0" + date.getHour() : String.valueOf(date.getHour());
		String minute = (date.getMinute() < 10) ? "0" + date.getMinute() : String.valueOf(date.getMinute());
		String second = (date.getSecond() < 10) ? "0" + date.getSecond() : String.valueOf(date.getSecond());
		return String.valueOf(date.getDay()) + "/" + String.valueOf(date.getMonth()) + "/" + String.valueOf(date.getYear()) + " - [" + String.valueOf(hour) + ":" + String.valueOf(minute) + ":" + String.valueOf(second) + "]";
	}
}
